<?php

namespace App\Models\UCenter;

use App\Models\BaseModel;

class CompanyDriver extends BaseModel
{
    protected $table = 'company_driver';
    public $dateFormat = 'Y-m-d H:i:s';
    public function driver(){
        return $this->belongsTo('App\Models\User\User','driver_id','id');
    }

    public function company(){
        return $this->hasOne('App\Models\User\User','id','company_id');
    }

    public function car(){
        return $this->hasOne('App\Models\Car\Car','user_id','driver_id');
    }

    public function company_info(){
        return $this->hasOne('App\Models\Company\Company','user_id','company_id');
    }

    public function waybill(){
        return $this->belongsTo('App\Models\Cargo\WayBill','driver_id','driver_id');
    }

}
